﻿<%@ Page Title="" Language="C#" MasterPageFile="~/module/Fontend.Master" AutoEventWireup="true" CodeBehind="KidWallView.aspx.cs" Inherits="mamnontuoitho7.module.KidWallView" ValidateRequest="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">

<script language="javascript" type="text/javascript">

    function Wall_Click() {

        var commentContent = trim(document.getElementById("<%= txtWall.ClientID %>").value);
        var leng = commentContent.length;
        if (leng < 10 || leng > 1000) {
            alert("Cần gõ hơn 10 ký tự và không quá 1000 ký tự");
            return false;
        }
    }
    function trim(str) {
        return str.replace(/^\s+|\s+$/g, "");
    }
</script>

<div class="accounts">
    <div class="login-name">
        <div class="login-name-left"></div>
        <span class="login-name-middle"><%= Session["fullname"].ToString()%></span>
        <div class="login-name-right"></div>
    </div>
    
    <div class="block-menu">
    <% if (Session["role"].ToString() == "3")
       { %>
        <ul>
            <li><a href="TeacherConversation.aspx">Các cuộc hội thoại</a></li>
            <li class="active"><a href="TeacherKidList.aspx">Danh sách Bé</a></li>
            <li><a href="TeacherWarning.aspx">Thông báo</a></li>
            <li><a href="TeacherProfile.aspx">Thông tin tài khoản</a></li>
            <li><a href="ChangeAvatar.aspx">Thay đổi Avatar</a></li>
        </ul>
        <%}
       else if (Session["role"].ToString() == "4")
       { %>
       <ul>
            <li><a href="ParentConversation.aspx">Các cuộc hội thoại</a></li>
            <li class="active"><a href="ParentKidList.aspx">Danh sách Bé</a></li>
            <li><a href="ParentWarning.aspx">Thông báo</a></li>
            <li><a href="ParentProfile.aspx">Thông tin tài khoản</a></li>
            <li><a href="ChangeAvatar.aspx">Thay đổi Avatar</a></li>
        </ul>
        <%} %>
    </div>
    <div class="block-content"></div>
</div>
<div class="block-tabcontent">
    <ul class="tabs">
        <li><a href="KidDetails.aspx?KidID=<%= _kidID%>" rel="KidDetails">Thông tin của Bé</a></li>
        <li class="selected"><a href="KidWallView.aspx?KidID=<%= _kidID%>" rel="KidWallView">Tường của Bé</a></li>
        <li class="last"><a href="KidHealInfoView.aspx?KidID=<%= _kidID%>" rel="KidHealInfoView">Thông tin sức khỏe của Bé</a></li>
    </ul>
    <div class="tabcontents">
        <div id="KidWallView" class="tabcontent">
        <% if (_checkValidKid)
           { %>
              <% if (Session["role"].ToString() == "3")
                 { %>
                    <form id="form1" runat="server">
                         <asp:Panel ID="Panel2" DefaultButton="btnWallSend" runat="server">
                            <asp:TextBox ID="txtWall" runat="server" TextMode="MultiLine" CssClass="tab_textarea"></asp:TextBox><br />
                            <asp:Button ID="btnWallSend" runat="server" CssClass="tab_button" style="float:right;margin-top:8px;" 
                                Text="Gửi" onclick="btnWallSend_Click" OnClientClick="return Wall_Click()"/>
                          </asp:Panel>
                    </form>
               <%} %>
               <%
                /* write code get datatable show into for loop */
                for (int i = 0; i < _dtWall.Rows.Count; i++)
                {
                   %>
                    <div class="commentdetail" style="width:auto;margin: 10px 0 15px;">
                        <img src="../images/avatar/teacher_parents/icon-avatar.png" alt=""/>
                        <span class="arrow"><span></span></span>

                        <div class="blockcontent" style="width: 470px;margin-left: 17px;">
                            <div class="content">
                                <%= _general.ReplaceSpecialCharacters(_dtWall.Rows[i]["Content"].ToString())%>     
                            </div>
                            <div class="info">
                                <div class="info_fl">
                                    bởi <a href="ProfileInfo.aspx?MemberID=<%=_dtWall.Rows[i]["MemberID"].ToString() %>"  class="groupprofile"> 
                                            <%= _dtWall.Rows[i]["FullName"].ToString()%>
                                        </a> 
                                    lúc: <%= DateTime.Parse(_dtWall.Rows[i]["CreateDate"].ToString()).ToString("dd/MM/yyyy")%> 
                                </div>
                                <div class="info_fr">
                                    <%if (_kidWall.CheckWallOwner(Session["memberID"].ToString(), _dtWall.Rows[i]["KidWallID"].ToString()) && Session["role"].ToString() == "3")
                                      {%>
                                       <form method="post" action="KidWallView.aspx?KidID=<%= _kidID%>&page=<%=_pageflag %>">
                                           <input type="hidden" id="Hidden2" name="hidWallIDDelete" value="<%=_dtWall.Rows[i]["KidWallID"].ToString() %>" />
                                           <button type="submit" class="tab_button" onclick="javascript: if (confirm('Bạn muốn xóa?')) { window.location.href='#' } else { return false; };">Xóa</button>
                                       </form>
                                    
                                    <%} %>
                                </div>
                            </div>
                            
                        </div>
                    </div>
                  <%} %>       

                  <div id="container" style="width:auto;">
                    <div class="pagination">
                        <%if (_currentbar > 1)
                          { %>
                        <a href="KidWallView.aspx?a=-1&KidID=<%= _kidID%>" class="pagecyan"><<</a>
                        <%} %>
                        <%  
                for (int j = _beginPage; j <= _endPage; j++)
                {
                    if (j == _pageflag)
                    {
                        %>
                        <a href="KidWallView.aspx?page=<%= j%>&KidID=<%= _kidID%>" class="pagecyan active"><%= j%></a>
                  <%}
                    else
                    { %>
                        <a href="KidWallView.aspx?page=<%= j%>&KidID=<%= _kidID%>" class="pagecyan"><%= j%></a>
                  <%}
                } %>

             <%if(_currentbar < _totalBars)
               {%>
            <a href="KidWallView.aspx?a=1&KidID=<%= _kidID%>" class="pagecyan">>></a>
             <%}
           }%>
                </div>
            </div>

        </div>
    </div>
</div>
</asp:Content>
